<#-- ********************************************* -->
<#-- Displays the topic folder image by its status -->
<#-- ********************************************* -->
<#macro folderImage topic>
	<#if topic.movedId == 0 || (forum?exists && topic.forumId == forum.id)>
		<#if topic.read>
			<#if topic.status == STATUS_UNLOCKED>
				<#if topic.type == TOPIC_ANNOUNCE>
				    icon_folder_announce
				<#elseif topic.type == TOPIC_STICKY>
					icon_folder_sticky
				<#else>
					<#if topic.isHot()>
						icon_folder_hot
					<#else>
					    icon_folder
					</#if>
				</#if>
			<#else>
				icon_folder_lock
			</#if>
		<#else>
			<#if topic.status == STATUS_UNLOCKED>
				<#if topic.type == TOPIC_ANNOUNCE>
					icon_folder_announce_new
				<#elseif topic.type == TOPIC_STICKY>
					icon_folder_sticky_new
				<#else>
					<#if topic.isHot()>
						icon_folder_new_hot
					<#else>
						icon_folder_new
					</#if>
				</#if>
			<#else>
				icon_folder_lock_new
			</#if>
		</#if>
	<#else>
		icon_topic_move
	</#if>
</#macro>

<#macro renderPoll poll>
<div class="panel">
		<div class="inner"><span class="corners-top"><span></span></span>
		<div class="content">
			<h2>${poll.label}</h2>
			<p class="author"></p>
			<fieldset class="polls">
			<#list poll.options as option>
				<dl class="voted" title="You voted for this option" width="210">
					<dt>${option.text}</dt>
					<dd class="resultbar"><div class="pollbar5" style="width:${option.votePercentage * 2}">${option.voteCount}</div></dd>
					<dd>${option.votePercentage}%</dd>
				</dl>
			</#list>			
				
				<dl>
					<dt>&nbsp;</dt>
					<dd class="resultbar">${I18n.getMessage("PostShow.pollTotalVotes")} ${poll.totalVotes}</dd>
				</dl>
			</fieldset>
		</div>
		<span class="corners-bottom"><span></span></span></div>
</div>

</#macro>

<#macro row1Class topic><#if topic.type == TOPIC_ANNOUNCE>row1Announce<#elseif topic.type == TOPIC_STICKY>row1sticky<#else>row1</#if></#macro>
<#macro row2Class topic><#if topic.type == TOPIC_ANNOUNCE>row2Announce<#elseif topic.type == TOPIC_STICKY>row2sticky<#else>row2</#if></#macro>
<#macro row3Class topic><#if topic.type == TOPIC_ANNOUNCE>row3Announce<#elseif topic.type == TOPIC_STICKY>row3sticky<#else>row3</#if></#macro>

<#-- ****************** -->
<#-- Moderation buttons -->
<#-- ****************** -->
<#macro moderationButtons>
	<#if moderator  && openModeration?default(false)>
		<#if can_remove_posts?default(false)><input type="submit" name="topicRemove" value="&nbsp;&nbsp;${I18n.getMessage("Delete")}&nbsp;&nbsp;" class="button2" onclick="return validateModerationDelete();" /></#if>
		<#if can_move_topics?default(false)><input type="submit" name="topicMove" value="&nbsp;&nbsp;${I18n.getMessage("move")}&nbsp;&nbsp;" class="button2" onclick="return verifyModerationCheckedTopics();" /></#if>
		<#if can_lockUnlock_topics?default(false)>
			<input type="submit" name="topicLock" value="&nbsp;&nbsp;${I18n.getMessage("Lock")}&nbsp;&nbsp;" class="button2" onclick="return lockUnlock();" />
			<input type="submit" name="topicUnlock" value="&nbsp;&nbsp;${I18n.getMessage("Unlock")}&nbsp;&nbsp;" class="button2" onclick="return lockUnlock();" />
		</#if>
	</#if>
</#macro>

<#-- ****************** -->
<#-- Moderation images -->
<#-- ****************** -->
<#macro moderationImages>
	<script type="text/javascript">
	function todo(name) { var todo = document.getElementById("moderationTodo"); todo.name = name; todo.value = "1"; }
	
	function deleteTopic() {
		if (confirm("${I18n.getMessage("Moderation.ConfirmDelete")}")
			&& askModerationReason()) {
			todo("topicRemove");
			document.formModeration.returnUrl.value = "${JForumContext.encodeURL("/forums/show/${topic.forumId}")}";
			document.formModeration.log_type.value = "1";
			document.formModeration.submit();
		}
	}

	function moveTopic() {
		todo("topicMove");
		document.formModeration.submit();
	}

	function lockUnlock(lock) {
		if (askModerationReason()) {
			document.formModeration.log_type.value = "3";
			todo(lock ? "topicLock" : "topicUnlock");
			document.formModeration.submit();
		}
	}
	</script>
	<form action="${JForumContext.encodeURL("/jforum")}" method="post" name="formModeration" id="formModeration">
		<input type="hidden" name="action" value="doModeration" />
		<input type="hidden" name="module" value="moderation" />
		<input type="hidden" name="returnUrl" value="${JForumContext.encodeURL("/${moduleName}/${action}/${start}/${topic.id}")}" />
		<input type="hidden" name="forum_id" value="${topic.forumId}" />
		<input type="hidden" name="topic_id" value="${topic.id}" />
		<input type="hidden" name="log_type" value="0"/>
		<input type="hidden" name="log_description">
		<input type="hidden" id="moderationTodo" />


<fieldset class="display-options">
	
		<#if can_remove_posts?default(false)>
			<a  href="javascript:deleteTopic();">${I18n.getMessage("Delete")}</a>
		</#if>
		
		<#if can_move_topics?default(false)>
			&nbsp;&bull;&nbsp;<a href="javascript:moveTopic();">${I18n.getMessage("move")}</a>
		</#if>

		<#if can_lockUnlock_topics?default(false)>			
			&nbsp;&bull;&nbsp;
			<#if topic.status == STATUS_LOCKED>
				<a href="javascript:lockUnlock(false);">${I18n.getMessage("Unlock")}</a>
			<#else>
				<a href="javascript:lockUnlock(true);">${I18n.getMessage("Lock")}</a>
			</#if>
		</#if>

		</fieldset>
</form>

</#macro>

<#-- ********************** -->
<#-- Forum navigation combo -->
<#-- ********************** -->
<#macro forumsComboTable>
	<form method="post" id="f" name="f" action="" onsubmit="if(this.f.value == -1){return false;}">
		<fieldset class="jumpbox">
	
			<label for="select" accesskey="j">${I18n.getMessage("ForumIndex.jumpTo")}:</label>
			<select onchange="if(this.options[this.selectedIndex].value != -1){ document.location = '${contextPath}/forums/show/'+ this.options[this.selectedIndex].value +'${extension}'; }" name="select">
			    <option value="-1" selected="selected">${I18n.getMessage("ForumIndex.goToSelectAForum")}</option>
			    <#list allCategories as category>
                            <optgroup label="${category.name}">
		
							<#list category.getForums() as forum>
								<option value="${forum.id}">${forum.name}</option>
							</#list>
							
                            </optgroup>
				</#list>
			</select>
			<input class="button2" type="button" value="${I18n.getMessage("ForumIndex.goToGo")}" onclick="if(document.f.select.options[document.f.select.selectedIndex].value != -1){ document.location = '${contextPath}/forums/show/'+ document.f.select.options[document.f.select.selectedIndex].value +'${extension}'; }" />
		</fieldset>
	</form>
</#macro>
